Skip to main content

read from process

Type

command

Summary

Accepts the output of a process that was opened with the open process command, placing the data in the it variable.

Syntax

read from process <processName> [at <start>] {until {<string> | empty | end | EOF} | for <amount> [<chunkType>]} [in <time>]

Description

Use the read from process command to get the output data from another program.

The until form reads data until the specified string is encountered. The until end and until eof forms read data until the process specifies it is finished. When until empty is used the data is read in at specified time intervals. If, when checked, the data is empty, the openProcesses function is used to check whether the process has finished.

Parameters

NameTypeDescription

processName

string

The processName specifies the name and location of the process you want to read from. It must be the same as the path you used with the open process command.

Important: The processName is case-sensitive, even on platforms where file names are not case-sensitive. It must be exactly the same--including the case of characters--as the name you used with the open process command.

start

string

The start specifies the character or byte position in the process output where you want to begin reading.

chunkType

The chunkType is one of chars, characters, words, items, lines, int1, uInt1, int2, uint2, int4, or uint4. The read from process command reads amount of the specified chunkType. If you don't specify a chunkType, amount characters are read.

time

The time is the time to wait for the read to be completed, in milliseconds, seconds, or ticks.

string

string

The string is any expression that evaluates to a string. When LiveCode encounters the string in the process output, it stops reading. If the string is not encountered, the read from process command continues reading as long as there is data to be read.

amount

integer

The amount is a positive integer and specifies how much data to read.

Examples

read from process "compileData" for 20
read from process "/etc/pr" at 2 until linefeed -- skip 2 chars
read from process myProcess for 10 int4s in 250 milliseconds

control structure: function

function: openProcesses, ticks, result, milliseconds

glossary: platform, binary file, variable, byte, case-sensitive, expression, evaluate, command, process

keyword: uInt2, string, int1, characters, int4, integer, int2, real4, uInt4, stdin, it, uInt1, character, real8

command: open process, close process, write to process, read from driver

constant: EOF

Compatibility and Support

Introduced

LiveCode 1.0

OS

mac

windows

linux

Platforms

desktop

server

Thank you for your feedback!

Was this page helpful?